// 冒泡排序demo
function bubbleSort(arr) {
  var i = arr.length, j;
  var tempExchangVal;
  while (i > 0) {
      for (j = 0; j < i - 1; j++) {
          if (arr[j] > arr[j + 1]) {
              tempExchangVal = arr[j];
              arr[j] = arr[j + 1];
              arr[j + 1] = tempExchangVal;
          }
      }
      i--;
  }
  return arr;
}

var arr = [3, 2, 4, 9, 1, 5, 7, 6, 8];
var arrSorted = bubbleSort(arr);
console.log(arrSorted);


var ccc = [5,6,8,4]
console.log(ccc,'111');
ccc[2] = 5;
console.log(ccc,'222');